Results for exercise 7b, page 137 followed with a sequencial analysis 

sample 1. 

Factorial(4)= 24 and lasts 500 nSeconds. 
Factorial(7)= 5040 and lasts 500 nSeconds. 
Factorial(6)= 720 and lasts 700 nSeconds. 
Factorial(5)= 120 and lasts 700 nSeconds. 

	fact(4) finished (join), at time: 500 . 
	fact(5) finished (join), at time: 700 . 
	fact(6) finished (join), at time: 700 . 
	fact(7) finished (join), at time: 500 . 

Unsorted

 Sorted by Time 
Factorial(4)= 24 and last 500 nSeconds. Pos nr. 1 . 
Factorial(7)= 5040 and last 500 nSeconds. Pos nr. 2 . 
Factorial(5)= 120 and last 700 nSeconds. Pos nr. 3 . 
Factorial(6)= 720 and last 700 nSeconds. Pos nr. 4 .

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 500 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 300 nSeconds. 
Fact(7)= 5040 and lasts 300 nSeconds. 

----------------------------------------------------------

as before, but other results => sample 2. 

Factorial(4)= 24 and lasts 500 nSeconds. 
Factorial(5)= 120 and lasts 600 nSeconds. 
Factorial(6)= 720 and lasts 600 nSeconds. 
Factorial(7)= 5040 and lasts 800 nSeconds. 

	fact(4) finished (join), at time: 500 . 
	fact(5) finished (join), at time: 600 . 
	fact(6) finished (join), at time: 600 . 
	fact(7) finished (join), at time: 800 . 

It was: unsorted 

Now: Sorted by Time elapsed, in nSeconds. 

Factorial(4)= 24 and last 500 nSeconds. Pos nr. 1 . 
Factorial(5)= 120 and last 600 nSeconds. Pos nr. 2 . 
Factorial(6)= 720 and last 600 nSeconds. Pos nr. 3 . 
Factorial(7)= 5040 and last 800 nSeconds. Pos nr. 4 . 

Thread A fact(4) is very quick. 
Thread B fact(5) is quick. 
Thread C fact(6) is normal. 
Thread D fact(7) is slow.

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 500 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 300 nSeconds. 
Fact(7)= 5040 and lasts 200 nSeconds. 

----------------------------------------------------------

sample 3. 

Same exercise with 4 threads=> compare execution fact(4).. fact(7), 
but using keyword 'synchronized' for method 
private synchronized int computeFactorial(...) 

Factorial(4)= 24 and lasts 400 nSeconds. 
Factorial(7)= 5040 and lasts 700 nSeconds. 

	fact(4) finished (join), at time: 400 . 
Factorial(6)= 720 and lasts 700 nSeconds. 
Factorial(5)= 120 and lasts 500 nSeconds. 

	fact(5) finished (join), at time: 500 . 
	fact(6) finished (join), at time: 700 . 
	fact(7) finished (join), at time: 700 . 

Unsorted

 Sorted by Time 
Factorial(4)= 24 and last 400 nSeconds. Pos nr. 1 . 
Factorial(5)= 120 and last 500 nSeconds. Pos nr. 2 . 
Factorial(6)= 720 and last 700 nSeconds. Pos nr. 3 . 
Factorial(7)= 5040 and last 700 nSeconds. Pos nr. 4 . 
Thread A fact(4) is very quick. 
Thread B fact(5) is quick. 
Thread C fact(6) is normal. 
Thread D fact(7) is slow.

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 500 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 300 nSeconds. 
Fact(7)= 5040 and lasts 200 nSeconds. 

----------------------------------------------------------

as before, but other results => sample 4. 

Factorial(4)= 24 and lasts 500 nSeconds. 

Factorial(5)= 120 and lasts 700 nSeconds. 
	fact(4) finished (join), at time: 500 . 
	fact(5) finished (join), at time: 700 . 

Factorial(7)= 5040 and lasts 900 nSeconds. 

Factorial(6)= 720 and lasts 600 nSeconds. 
	fact(6) finished (join), at time: 600 . 
	fact(7) finished (join), at time: 900 . 

It was: unsorted 

Now: Sorted by Time elapsed, in nSeconds. 

Factorial(4)= 24 and last 500 nSeconds. Pos nr. 1 . 
Factorial(6)= 720 and last 600 nSeconds. Pos nr. 2 . 
Factorial(5)= 120 and last 700 nSeconds. Pos nr. 3 . 
Factorial(7)= 5040 and last 900 nSeconds. Pos nr. 4 .

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 500 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 200 nSeconds. 
Fact(7)= 5040 and lasts 200 nSeconds. 

----------------------------------------------------------

Same exercise but with 12 threads=> compare execution fact(4).. fact(15), 


and no syncr keyword Sample 5. 

Factorial(4)= 24 and lasts 500 nSeconds. 

Factorial(5)= 120 and lasts 700 nSeconds. 
	fact(4) finished (join), at time: 500 . 
	fact(5) finished (join), at time: 700 . 

Factorial(6)= 720 and lasts 600 nSeconds. 

	fact(6) finished (join), at time: 600 . 
Factorial(7)= 5040 and lasts 400 nSeconds. 
Factorial(8)= 40320 and lasts 600 nSeconds. 

	fact(7) finished (join), at time: 400 . 

	fact(8) finished (join), at time: 600 . 
Factorial(9)= 362880 and lasts 700 nSeconds. 
Factorial(11)= 39916800 and lasts 700 nSeconds. 
Factorial(10)= 3628800 and lasts 700 nSeconds. 
Factorial(13)= 6227020800 and lasts 700 nSeconds. 

	fact(9) finished (join), at time: 700 . 

Factorial(12)= 479001600 and lasts 700 nSeconds. 
	fact(10) finished (join), at time: 700 . 
	fact(11) finished (join), at time: 700 . 
	fact(12) finished (join), at time: 700 . 

Factorial(14)= 87178291200 and lasts 600 nSeconds. 
	fact(13) finished (join), at time: 700 . 
	fact(14) finished (join), at time: 600 . 

Factorial(15)= 1307674368000 and lasts 900 nSeconds. 
	fact(15) finished (join), at time: 900 . 
It was: unsorted

 Now: Sorted by Time 

Factorial(7)= 5040 and last 400 nSeconds. Pos nr. 1 . 
Factorial(4)= 24 and last 500 nSeconds. Pos nr. 2 . 
Factorial(6)= 720 and last 600 nSeconds. Pos nr. 3 . 
Factorial(8)= 40320 and last 600 nSeconds. Pos nr. 4 . 
Factorial(14)= 87178291200 and last 600 nSeconds. Pos nr. 5 . 
Factorial(5)= 120 and last 700 nSeconds. Pos nr. 6 . 
Factorial(9)= 362880 and last 700 nSeconds. Pos nr. 7 . 
Factorial(10)= 3628800 and last 700 nSeconds. Pos nr. 8 . 
Factorial(11)= 39916800 and last 700 nSeconds. Pos nr. 9 . 
Factorial(12)= 479001600 and last 700 nSeconds. Pos nr. 10 . 
Factorial(13)= 6227020800 and last 700 nSeconds. Pos nr. 11 . 
Factorial(15)= 1307674368000 and last 900 nSeconds. Pos nr. 12 .

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 400 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 500 nSeconds. 
Fact(7)= 5040 and lasts 400 nSeconds. 
Fact(8)= 40320 and lasts 300 nSeconds. 
Fact(9)= 362880 and lasts 300 nSeconds. 
Fact(10)= 3628800 and lasts 400 nSeconds. 
Fact(11)= 39916800 and lasts 400 nSeconds. 
Fact(12)= 479001600 and lasts 400 nSeconds. 
Fact(13)= 6227020800 and lasts 400 nSeconds. 
Fact(14)= 87178291200 and lasts 300 nSeconds. 
Fact(15)= 1307674368000 and lasts 300 nSeconds. 

----------------------------------------------------------

Same exercise but with 12 threads=> compare execution fact(4).. fact(15), 
and syncr keyword Sample 6. 

Factorial(5)= 120 and lasts 600 nSeconds. 


Factorial(6)= 720 and lasts 400 nSeconds. 
Factorial(4)= 24 and lasts 500 nSeconds. 
Factorial(7)= 5040 and lasts 700 nSeconds. 
Factorial(8)= 40320 and lasts 600 nSeconds. 
Factorial(9)= 362880 and lasts 300 nSeconds. 
Factorial(10)= 3628800 and lasts 700 nSeconds. 
Factorial(11)= 39916800 and lasts 600 nSeconds. 
Factorial(12)= 479001600 and lasts 400 nSeconds. 

	fact(4) finished (join), at time: 500 . 
	fact(5) finished (join), at time: 600 . 
	fact(6) finished (join), at time: 400 . 
	fact(7) finished (join), at time: 700 . 
	fact(8) finished (join), at time: 600 . 
	fact(9) finished (join), at time: 300 . 
	fact(10) finished (join), at time: 700 . 
	fact(11) finished (join), at time: 600 . 

Factorial(13)= 6227020800 and lasts 900 nSeconds. 

Factorial(14)= 87178291200 and lasts 700 nSeconds. 
	fact(12) finished (join), at time: 400 . 
	fact(13) finished (join), at time: 900 . 
	fact(14) finished (join), at time: 700 . 

Factorial(15)= 1307674368000 and lasts 700 nSeconds. 
	fact(15) finished (join), at time: 700 . 
It was: unsorted

 Now: Sorted by Time 

Factorial(9)= 362880 and last 300 nSeconds. Pos nr. 1 . 
Factorial(6)= 720 and last 400 nSeconds. Pos nr. 2 . 
Factorial(12)= 479001600 and last 400 nSeconds. Pos nr. 3 . 
Factorial(4)= 24 and last 500 nSeconds. Pos nr. 4 . 
Factorial(5)= 120 and last 600 nSeconds. Pos nr. 5 . 
Factorial(8)= 40320 and last 600 nSeconds. Pos nr. 6 . 
Factorial(11)= 39916800 and last 600 nSeconds. Pos nr. 7 . 
Factorial(7)= 5040 and last 700 nSeconds. Pos nr. 8 . 
Factorial(10)= 3628800 and last 700 nSeconds. Pos nr. 9 . 
Factorial(14)= 87178291200 and last 700 nSeconds. Pos nr. 10 . 
Factorial(15)= 1307674368000 and last 700 nSeconds. Pos nr. 11 . 
Factorial(13)= 6227020800 and last 900 nSeconds. Pos nr. 12 .

 **** Static sequential analysis *** 

Fact(4)= 24 and lasts 500 nSeconds. 
Fact(5)= 120 and lasts 300 nSeconds. 
Fact(6)= 720 and lasts 200 nSeconds. 
Fact(7)= 5040 and lasts 500 nSeconds. 
Fact(8)= 40320 and lasts 400 nSeconds. 
Fact(9)= 362880 and lasts 200 nSeconds. 
Fact(10)= 3628800 and lasts 300 nSeconds. 
Fact(11)= 39916800 and lasts 300 nSeconds. 
Fact(12)= 479001600 and lasts 300 nSeconds. 
Fact(13)= 6227020800 and lasts 300 nSeconds. 
Fact(14)= 87178291200 and lasts 300 nSeconds. 
Fact(15)= 1307674368000 and lasts 300 nSeconds. 


